home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / gsuid.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  2.5 KB  |  73 lines

  1. /* Copyright (C) 1992, 1993, 1998 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: gsuid.h,v 1.2 2000/09/19 19:00:33 lpd Exp $ */
  20. /* Unique id definitions for Ghostscript */
  21.  
  22. #ifndef gsuid_INCLUDED
  23. #  define gsuid_INCLUDED
  24.  
  25. /* A unique id (uid) may be either a UniqueID or an XUID. */
  26. /* (XUIDs are a Level 2 feature.) */
  27. #ifndef gs_uid_DEFINED
  28. #  define gs_uid_DEFINED
  29. typedef struct gs_uid_s gs_uid;
  30.  
  31. #endif
  32. struct gs_uid_s {
  33.     /* id >= 0 is a UniqueID, xvalues is 0. */
  34.     /* id < 0 is an XUID, size of xvalues is -id. */
  35.     long id;
  36.     long *xvalues;
  37. };
  38.  
  39. /*
  40.  * A UniqueID of no_UniqueID is an indication that there is no uid.
  41.  * Since we sometimes use gs_ids as UniqueIDs, we want to choose as large
  42.  * a (positive) value as possible for no_UniqueID.
  43.  */
  44. #define no_UniqueID max_long
  45. #define uid_is_valid(puid)\
  46.   ((puid)->id != no_UniqueID)
  47. #define uid_set_invalid(puid)\
  48.   ((puid)->id = no_UniqueID, (puid)->xvalues = 0)
  49. #define uid_is_UniqueID(puid)\
  50.   (((puid)->id & ~0xffffff) == 0)
  51. #define uid_is_XUID(puid)\
  52.   ((puid)->id < 0)
  53.  
  54. /* Initialize a uid. */
  55. #define uid_set_UniqueID(puid, idv)\
  56.   ((puid)->id = idv, (puid)->xvalues = 0)
  57. #define uid_set_XUID(puid, pvalues, siz)\
  58.   ((puid)->id = -(long)(siz), (puid)->xvalues = pvalues)
  59.  
  60. /* Get the size and the data of an XUID. */
  61. #define uid_XUID_size(puid) ((uint)(-(puid)->id))
  62. #define uid_XUID_values(puid) ((puid)->xvalues)
  63.  
  64. /* Compare two uids for equality. */
  65. /* This could be a macro, but the Zortech compiler compiles it wrong. */
  66. bool uid_equal(P2(const gs_uid *, const gs_uid *));    /* in gsutil.c */
  67.  
  68. /* Free the XUID array of a uid if necessary. */
  69. #define uid_free(puid, mem, cname)\
  70.   gs_free_object(mem, (puid)->xvalues, cname)
  71.  
  72. #endif /* gsuid_INCLUDED */
  73.